package hu.plajko.server;

import java.util.ArrayList;
import java.util.List;

public class ThreadTest {

	public static void main(String[] args) {
		System.out.println(alma());

	}

	private static String alma() {
		final List<String> ret = new ArrayList<String>();
		Thread t = new Thread(new Runnable() {
			@Override
			public void run() {
				synchronized (ret) {
					try {
						ret.wait(4000);
					} catch (InterruptedException e) {
						e.printStackTrace();
					}
					ret.add("alma");
				}
			}
		});
		t.start();

		try {
			Thread.sleep(500);
		} catch (InterruptedException e1) {
			e1.printStackTrace();
		}
		synchronized (ret) {
			ret.notify();
		}

		try {
			t.join();
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		return ret.toString();
	}
}
